# 查询组织

from datetime import datetime, timedelta, timezone
from typing import Union
from fastapi import APIRouter, Depends, HTTPException, status, Body, Request
from sqlalchemy.orm import Session
from router.route_log import LogRoute
from model.User import UserModel
from model.Group import GroupModel
from common.setting import settings
from common.db_init import get_db
from common.response import ApiResponse, CustomApiResponse, response_code, responseCode
from common.custom_log import my_logger
from utils.tool import Page

groupController = APIRouter(prefix='/group',route_class=LogRoute)


@groupController.get('/list', response_model=CustomApiResponse)
def getlist(page: int = 1, pagesize: int = 10, db: Session = Depends(get_db)):
    pageModel = Page(page=page, pagesize=pagesize)
    grouplist = GroupModel.get_list(db=db, page={'start': pageModel.skip, 'pagesize': pagesize})
    print(grouplist)
